package ru.urfc.portal.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import ru.urfc.portal.ui.client.Constants;

@Entity
@XmlRootElement(name = Constants.BRANCH)
public class Branch extends SysObject {
	
	public static final Branch SVERD = new Branch(null, "sverd", "Свердловский", "Свердловская область","corebolg800fg0000ifs25t7hkqfmc28");
	public static final Branch CHEL = new Branch(null, "chel", "Челябинский", "Челябинская область","corebolg800fg0000ifs2750imrc9fqg");
	public static final Branch TYUMEN = new Branch(null, "tyum", "Тюменский", "Тюменская область","corebolg800fg0000ifs26sik32cigf0");
	public static final Branch KURGAN = new Branch(null, "kurg", "Курганский", "Курганская область","corebolg800fg0000ifs26i5ie1pp110");
	
	@Column(nullable = false, unique = true)
	private String code;
	@Column(nullable = false, unique = true)
	private String name;
	private String region;
	public String folderUuid;
	
	public Branch() {
	}

	public Branch(Long id, String code, String name, String region, String folderUuid) {
		super(id);
		this.code = code;
		this.name = name;
		this.region = region;
		this.folderUuid = folderUuid;
	}

	@XmlElement
	public String getCode() {
		return code;
	}
	
	@XmlElement
	public String getName() {
		return name;
	}
	
	@XmlElement
	public String getRegion() {
		return region;
	}

	public boolean codeEquals(Branch branch) {
		return code.equals(branch.getCode());
	}
	
}
